home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / global-one-water.swf / scripts / __Packages / HUD.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.2 KB  |  37 lines

  1. class HUD extends MovieClip
  2. {
  3.    var engine;
  4.    var waterMeter;
  5.    var pause_btn;
  6.    var waterPumped_txt;
  7.    var flowRate_txt;
  8.    var happyKids_txt;
  9.    var tiredKids_txt;
  10.    var available_txt;
  11.    var time_txt;
  12.    var tips;
  13.    function HUD()
  14.    {
  15.       super();
  16.       this.engine = this._parent;
  17.       this.waterMeter.stop();
  18.       this.pause_btn.onRelease = Delegate.create(this,this.pressPause);
  19.    }
  20.    function update(waterPumped, pumpTarget, alreadyPumped, flowRate, happyKids, unhappyKids, availableKids, time)
  21.    {
  22.       this.waterPumped_txt.text = Format.number(waterPumped,2);
  23.       this.flowRate_txt.text = (flowRate < 0 ? "" : "+") + Format.number(flowRate * Engine.FPS * 60,0);
  24.       var _loc2_ = waterPumped / pumpTarget;
  25.       this.waterMeter.gotoAndStop(Math.floor(_loc2_ * (this.waterMeter._totalframes - 1)) + 1);
  26.       this.happyKids_txt.text = "x" + happyKids.toString();
  27.       this.tiredKids_txt.text = "" + unhappyKids.toString();
  28.       this.available_txt.text = "x" + availableKids.toString();
  29.       this.time_txt.text = Math.round(time.toString() / Engine.FPS) + "s";
  30.       this.tips.update();
  31.    }
  32.    function pressPause()
  33.    {
  34.       this.engine.paused = !this.engine.paused;
  35.    }
  36. }
  37.